package com.mmall.feign;

import com.mmall.common.base.ServerResponse;
import com.mmall.feign.fallBack.ProductFeignFallBack;
import com.mmall.pojo.param.AddProductParam;
import com.mmall.pojo.param.ProductPageParam;
import com.mmall.pojo.param.UpdateProductParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

/**
 * @author gg
 * @version ProductFeignService.java, v 0.1 2019-05-06 10:01 gg
 */
@FeignClient(name = "mmall-product", fallback = ProductFeignFallBack.class)
public interface ProductFeignService {

    /**
     * 添加商品
     *
     * @param addProductParam AddProductParam
     * @return ServerResponse
     */
    @PostMapping("add")
    ServerResponse add(@Valid @RequestBody AddProductParam addProductParam);

    /**
     * 添加商品
     *
     * @param updateProductParam UpdateProductParam
     * @return ServerResponse
     */
    @PostMapping("update")
    ServerResponse update(@Valid @RequestBody UpdateProductParam updateProductParam);

    /**
     * 分页列表 后台管理
     *
     * @param productPageParam ProductPageParam
     * @return ServerResponse
     */
    @GetMapping("page")
    ServerResponse page(ProductPageParam productPageParam);

    /**
     * 商品详情
     *
     * @param id 商品id
     * @return ServerResponse ItemVo 单个对象
     */
    @GetMapping("detail/{id}")
    ServerResponse detail(@PathVariable Long id);

    /**
     * 删除商品
     *
     * @param id 商品id
     * @return ServerResponse ItemVo 单个对象
     */
    @GetMapping("del/{id}")
    ServerResponse del(@PathVariable Long id);


}